<?php

//sharing requires a source user, a targer user, an object type, and object identifier, and a destination to go to on completion

@session_start();
$access_token = $_SESSION['access_token'];

	$suser = $access_token['user_id'];

	$tuser = $_REQUEST['tuser'];
	$tusername = $_REQUEST['tusername'];

	$topdir = "/home/boostpo1/public_html/chirplace.com/usr/".$suser."/prune/".$tuser.".pne";

	$pruneamount = 0;

	if (is_file($topdir))
	{
		$fh = @fopen($topdir, 'r');
		$pruneamount = @fread($fh, filesize($topdir));
		@fclose($fh);
	}
// now I need to display the followers of this user, 
?>
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js"></script>
	<script type="text/javascript" src="http://yui.yahooapis.com/2.5.1/build/animation/animation-min.js"></script>
	<script type="text/javascript" src="http://yui.yahooapis.com/2.5.1/build/dragdrop/dragdrop-min.js"></script>
	<script type="text/javascript" src="http://yui.yahooapis.com/2.5.1/build/slider/slider-min.js"></script>
	


<h1>Prune <?php echo $tusername; ?></h1>
<div>Choose an amount to prune <?php echo $tusername; ?>. Think of pruning as a way to filter some of <?php echo $tusername; ?>'s posts, without getting rid of all of them.<br /><br /> The more you prune, the less likely posts by <?php echo $tusername; ?> will appear in your timeline.<br /><br /> To display all the posts from <?php echo $tusername; ?>, choose the minimum pruning level (i.e. 0).<br /><br /> To prevent any posts from <?php echo $tusername; ?> from appearing in your timeline, choose the maximum pruning level (i.e. 100).</div>
<h3>Pruning level</h3>
<form action="_prune.php" method="POST">
<input type="hidden" name="tuser" value="<?php echo $tuser; ?>" />
<input type="hidden" name="suser" value="<?php echo $suser ?>" />

<div id="sliderbg" style="position:relative; background:url(images/bg-fader.gif) 5px 0 no-repeat; height:28px; width:228px;"> 
<div id="sliderthumb" style="position: absolute; top: 4px;"><img src="images/thumb-n.gif" alt="prune thumb" /></div>
</div>
<input id="pruneamount" name="pruneamount" maxlength="4" size="3" type="text" readonly="true" value="<?php echo $pruneamount; ?>" style="position:relative; left:230px; top:-24px; border:0px solid #ffffff" />
<br />
<input type="submit" value="Prune" />
</form>

<script type="text/javascript">
	var _slider;
	var _gammaVal = document.getElementById('pruneamount');
	
	var _range = 200;
	
	function init(){
		_slider = YAHOO.widget.Slider.getHorizSlider("sliderbg", "sliderthumb", 0, _range);
		_slider.subscribe('change', chgInterval); // Updates the text field and the image
		

        YAHOO.util.Event.on(_gammaVal, "blur", checkValue);
        YAHOO.util.Event.on(_gammaVal, "keydown", keyDown);
		checkValue();
	} 
	
	YAHOO.util.Event.onDOMReady(init);

	// Changes the text field value
	function chgValue(x){
		_gammaVal.value = parseInt(x/2);
	}

	

	// Changes the shown img tag
	function chgInterval(x){
		chgValue(x);
	}
	
	// Checks the value of the text field, and sets the slider to that value
	function checkValue(){
		i = parseInt(_gammaVal.value);

		if (isNaN(i)){
			i = _slider.getValue()/2;
		}
			
		_slider.setValue(i*2, false);
	}
	
	// Used to determine if the enter key has been pressed
	function keyDown(k){
		if (k.keyCode == 13){
			checkValue();
			return false;
		}
	}

</script>
